package kt

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import base.BaseFragment
import com.talk.debby.talk.R
import android.content.Intent
import kotlinx.android.synthetic.main.fragment_content.*
import talk.activity.PhotoViewActivity
import talk.activity.QuestionActivity


/**
 * Created by debby on 2018/5/22.
 * 描述:
 */
class ContentFragment : BaseFragment() {

    override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
        rootView = inflater.inflate(R.layout.fragment_content, container, false)
        return rootView
    }

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)
        initView()
    }

    override fun initView() {
//        val courseWare: LinearLayout = rootView.findViewById(R.id.ll_kejian)
//        val homework: LinearLayout = rootView.findViewById(R.id.ll_homework)
//        val video: LinearLayout = rootView.findViewById(R.id.ll_video)

        ll_kejian.setOnClickListener { courseWare() }
        ll_homework.setOnClickListener { homework() }
        ll_video.setOnClickListener { video() }

    }

    private fun courseWare() {
        val intent = Intent()
        intent.setClass(activity, PhotoViewActivity::class.java)
        activity!!.startActivity(intent)
    }

    private fun homework() {
        val intent = Intent()
        intent.setClass(activity, QuestionActivity::class.java)
        activity!!.startActivity(intent)
    }

    private fun video() {
        val intent = Intent()
        intent.setClass(activity, VideoActivity::class.java)
        activity!!.startActivity(intent)
    }
}